home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Python 1.4 / Python 1.4 source / Extensions / img / README.img < prev   
Encoding:
Text File  |  1996-03-18  |  5.5 KB  |  138 lines  |  [TEXT/R*ch]

  1. Python image file handling, version 1.2 dated 29-Aug-95
  2. -------------------------------------------------------
  3.  
  4. This directory contains the source to a number of python modules (both
  5. in C and in python) that support handling of many different image
  6. formats. The modules have been tested on an SGI running Irix 5.2 and
  7. (partially) on a Mac running System 7.5, with python 1.2.  They should
  8. be portable, though. All the C-modules should by dynamically loadable.
  9. If you have the new importdl.c that allows multiple modules to live in
  10. one .so file you can use that, but it is also possible to create an
  11. .so file per module.
  12.  
  13. Changes since 1.1
  14. ------------------
  15.  
  16. - PBM format is supported. Not much more bitmap support, though.
  17. - SGI format is supported without need for the imgsgi module.
  18. - Conversion from RGB to colormapped is supported.
  19. - Conversion from greyscale to bitmap is supported.
  20. - Conversion between various RGB formats is supported.
  21. - Formats are less opaque, they are more-or-less described by some
  22.   attributes.
  23. - All sources now use the new naming conventions.
  24.  
  25. All in all, you should now be able to take any image file and display
  26. a reasonable approximation on any display (or copy it to any format
  27. output file).
  28.  
  29. Other stuff needed
  30. ------------------
  31.  
  32. The modules need a number of freely available libraries: the pbmplus
  33. library, the tiff library and the IJG JPEG library. If you cannot find
  34. these in the conventional places: look in
  35. ftp://ftp.cwi.nl/pub/jack/python-img, I've put copies there. That's
  36. also where you can find the distribution of this stuff, incidentally.
  37.  
  38. Since the pbmplus error handling is not well-suited for use in python
  39. it has been modified. The pbmplus sources mentioned above contain that
  40. fix. Alternatively, you can get libpbm1.c.diff.Z, which contains the
  41. context diff of the fix. The fix, incidentally, is backward
  42. compatible. If you don't want the fix you should #undef PBMNEWERROR in
  43. imgp[pgb]mmodule.c. The effect of this is that an error in your pbm
  44. file will terminate python.
  45.  
  46. When you compile the libraries take care that you use the same C
  47. compiler as for the python distribution.
  48.  
  49. Building
  50. --------
  51.  
  52. The modules build like standard extension modules, see Guido's
  53. documentation on "Extending and embedding the Python
  54. Interpreter". Here's a quick guide for the brave of heart:
  55.  
  56. - Build the jpeg, tiff and pbm libraries.
  57. - Copy Setup.in to Setup and modify it. You have to provide the paths
  58.   to the libraries needed, and you may want to set  BASESETUP and
  59.   BASELIB. Also, SGI users should check the comment near where the
  60.   imgjpeg module is declared, the builtin jpeg module conflicts with
  61.   the cl module (but a python wrapper with the same functionality is
  62.   provided). 
  63. - Build a Makefile, with something like "make -f Makefile.pre.in
  64.   Makefile".
  65.  
  66. Testing
  67. -------
  68.  
  69. Go to the test directory and run 'python testimg.py'. This will read
  70. the images in the files starting with 'in-' and produce a number of
  71. files starting with 'out-'. For some image formats, it will also check
  72. that the data read is what is expected, but this cannot be done for
  73. all formats. So, use 'xv' or some other tool to confirm that the
  74. images all look as they should. For example 'out-rgb-b2t.ppm' should
  75. be a ppm file containing a full-color image, upside down. And, yes,
  76. the fella in the NOFX t-shirt is me.
  77.  
  78. There is one warning the test script can currently legally produce:
  79. about the upper byte of SGI RGB images being changed. Ignore it.
  80.  
  81. There is a second test program: xtestview.py. It will test
  82. the image converters by reading each file given on the command line
  83. and displaying it using X. You can specify the visual and depth to
  84. use, check the source. In the display window you can type
  85. Q to go to the next image or W to go to the next image after
  86. attempting to convert the image back to the original format (the
  87. result is a file starting with '@copy-').
  88.  
  89. The third test program, testview.py, is an SGI-only version of
  90. xtestview.py using GL window calls.
  91.  
  92. Documentation
  93. -------------
  94.  
  95. Yes, there is documentation! Copy the file doc/libimg.tex to your
  96. python Doc directory and modify lib.tex to include it. There's some
  97. stuff in the doc directory as well to help you creating documentation
  98. for the img modules only as well.
  99.  
  100. Hacking
  101. -------
  102.  
  103. You are hereby cordially invited to extend the functionality of the
  104. image stuff. If you already have support for some image fileformat and
  105. want to make it available with the interface here look at imgpxxx.py.
  106. If you want to write a module for some fileformat in C look at
  107. imgxxxmodule.c. If you want to add an internal format look at
  108. imgformatmodule.c and imgconvert.py.
  109.  
  110. Things I am very interested in:
  111. - Support for more image formats.
  112. - A colormapper that produces reasonable quality without being as
  113.   doggish as the FS mapper included
  114. - A better greyscale to monochrome converter.
  115.  
  116. Authors
  117. -------
  118.  
  119. The modules here were written by Jack Jansen and Sjoerd Mullender,
  120. Centrum voor Wiskunde en Informatica.
  121.  
  122. Some code in various modules was modified from code available to the
  123. public, so parts of the code were written (and possibly copyrighted)
  124. by Jeff Poskanzer, Sun Microsystems, Patrick J. Naughton, David
  125. Koblas, David Rowley, Marcel Wijkstra, CompuServe Incorporated,
  126. Spencer W. Thomas, Jim McKie, Steve Davies, Ken Turkowski, James
  127. A. Woods and Joe Orost. The relevant source files have the exact
  128. attribution and copyright status.
  129.  
  130. Complaints, bugs, fixes and other remarks can be sent to
  131. jack@cwi.nl. I'm especially interested in feedback on the interface,
  132. maybe we could discuss it in {comp.lang.python, the python-list@cwi.nl}.
  133.  
  134.                 Jack Jansen
  135.                 CWI
  136.                 August 1995.
  137.                 
  138.